package com.gougou.controller;

import com.gougou.context.ApplicationContextUtils;
import com.gougou.pojo.TbUser;
import com.gougou.service.impl.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by EX-ZHANZHENQIANG001 on 2018-04-18.
 */
@RequestMapping("/rest")
@Controller
public class RestController {

    @Autowired
    private UserServiceImpl userService;

    @ResponseBody
    @RequestMapping("/user")
    public Object user() {
        return userService.getUserByName(new TbUser("admin"));
    }


    @ResponseBody
    @RequestMapping("/appc")
    public Object appc() {
        ApplicationContextUtils applicationContextUtils = new ApplicationContextUtils();
        Object object = ApplicationContextUtils.getInstance().getBean("userServiceImpl");
        boolean bl = object instanceof UserServiceImpl;
        return bl;
    }

}
